package com.cti.commons.delayqueue.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cti.commons.delayqueue.core.DelayQueue;

/**
 * @author et.wang
 */
@RestController
@RequestMapping("/v1/queue")
public class DelayQueueEndpoint {

    @Autowired
    private DelayQueue delayQueue;

    /**
     * 删除任务
     *
     * @param messageId
     */
    @GetMapping("/delete/{messageId}")
    public void deleteJob(@PathVariable(name = "messageId") long messageId) {
        delayQueue.finish(messageId);
    }

}
